home *** CD-ROM | disk | FTP | other *** search
/ The Business Master (3rd Edition) / The Business Master (3rd Edition).iso / files / utilhive / zoo201 / stuff.doc < prev    next >
Text File  |  1989-03-20  |  13KB  |  332 lines

  1.                                  Stuff  2.0
  2.                                      by
  3.                                  Rahul Dhesi
  4.  
  5.  
  6. The executable form of the program Stuff 2.0, as compiled and distributed by
  7. me, is dedicated to the public domain.  Copyrighted source code suitable for
  8. Turbo C 1.0 is also distributed and may be used in conformance with the
  9. copyright statements contained in the source files.
  10.  
  11. The primary purpose of Stuff 2.0 is to generate pathnames that may be fed to
  12. zoo version 1.5 or later to allow it to recursively archive a directory
  13. hierarchy in compressed form.  Invoke it as "stuff" without any parameters to
  14. get a help screen.  Stuff should work on any MS-DOS system.  IBM
  15. compatibility is not a requirement.
  16.  
  17. Changes from version Stuff 1.0 are summarized at the end of this document in
  18. the section entitled CHANGES FROM VERSION 1.0.
  19.  
  20. Stuff is generally used as follows:
  21.  
  22.      stuff /new | zoo aI newfiles
  23.  
  24. The above pipeline causes Stuff to generate a list of all files in /new and
  25. its subdirectories and feed them to zoo, which in turn reads each filename
  26. and adds that file to the archive "newfiles.zoo".  Later, the zoo archive
  27. can be extracted with
  28.  
  29.      zoo x.// newfiles
  30.  
  31. to recreate the original directory hierarchy.
  32.  
  33. The general format of a Stuff command is:
  34.  
  35.      stuff pathnames ... [ conditions ... ]
  36.  
  37. Following the name of the program "stuff" itself, you need to give a list of
  38. one or more file or directory names in any combination.  Following these you
  39. can optionally specify some conditions that a file must meet before its name
  40. will be listed by Stuff.
  41.  
  42. In the simplest case, when all you want to do is archive all files in certain
  43. areas, you will simply say:
  44.  
  45.      stuff /new /old /test | zoo aI backups
  46.  
  47. The above command will cause all files in the /new, /old, and /test
  48. directories (and all subdirectories, and all subdirectories of
  49. subdirectories, and so on) to be archived into "backups.zoo".  Or you might
  50. archive certain selected files thus:
  51.  
  52.      stuff *.c *.h /turboc/include | zoo aI cprogs
  53.  
  54. This archives all *.c and *.h files in the current directory and also
  55. archives all files in /turboc/include and its subdirectories.
  56.  
  57. For greater control, conditions may be specified.  For example, to archive
  58. only files with certain names, a possible command is:
  59.  
  60.      stuff / ! -name *.obj ! -name @junk ! -name *.bak | zoo aI sources
  61.  
  62. This command asks Stuff to search the entire disk beginning with the root
  63. directory / and asks it to list names of all files EXCEPT those that match
  64. the patterns "*.obj" or "*.bak" or any of the patterns inside the file "junk".
  65. The exclamation mark tells Stuff to make the following condition exclude
  66. matching files.
  67.  
  68. Here is a list of all conditions accepted by Stuff 2.0:
  69.  
  70.   -name pattern    wildcards ok, * matches all files, dot is not special
  71.   -name @file      read patterns from file, one on each line
  72.   -size N          size is N kilobytes (+N means over N, -N means less than N)
  73.   -mtime N         modified N days ago (+N means over N, -N means less than N)
  74.   -modified        modified since last backup (tests "archive" bit)
  75.   -older filename  older than specified file (false if "filename" not found)
  76.   -newer filename  newer than specified file (true if "filename" not found)
  77.   -limit N         group files together, each group not to exceed N bytes
  78.  
  79. SELECTING BY NAME
  80.  
  81. Files are selected by name with the -name condition.  For example:
  82.  
  83.      -name pattern
  84.      -name @file
  85.  
  86. Both tell stuff to select a file if its name matches a supplied pattern.  The
  87. second form tells Stuff to get one or patterns, one per line, from the file
  88. whose name is given after the @ character.  See below for more information
  89. about the second form.
  90.  
  91. In each pattern, the wildcard characters ? and * may be used.  The ? wildcard
  92. matches any one character and * matches zero or more characters.  Arbitrary
  93. combinations may be used, and the dot is not special, so *x* will match
  94. "xyz.doc" as well as "doc.xyz".
  95.  
  96. To exclude files matching a pattern, use the ! character thus:
  97.  
  98.      ! -name pattern
  99.      ! -name @file
  100.  
  101. The first form excludes a file if its name matches the supplied pattern.  The
  102. second form allows you to use the patterns stored in a file.  See below for
  103. more information about the second form.
  104.  
  105. If a pattern contains no slashes, Stuff attempts to match only the filename
  106. part of each file found.  For example, "/myfiles/sources/stuff.c" will match
  107. the pattern "st*c".  But if the pattern contains any slashes, then it must
  108. match the entire pathname of each file found, so "/myfiles/sources/stuff.c"
  109. would not match "*/new/st*c" but it would match "*sources*/st*c".
  110.  
  111. If more than one -name condition is specified (without a preceding !), then a
  112. file is selected if it matches any one or more of them.  If a file is
  113. excluded with the "! -name" form, then it is never selected, even if it
  114. matches a pattern.  For example,
  115.  
  116.      -name *.com -name abc* ! -name /new/*
  117.  
  118. would select a files called "xyz.com", "abc.exe", and "abc.com", provided
  119. none of these was in the /new directory or any subdirectory in it.  It would
  120. not select a file called /new/abc.com because the ! condition excludes
  121. everything beginning with the characters "/new/".
  122.  
  123.  
  124. SELECTING FILES FROM A LONG LIST
  125.  
  126. The @file syntax allows you to create lists of files to select or exclude.
  127. For example, suppose we have a file called SELECT containing the following
  128. filename patterns, one per line, with no extraneous blanks:
  129.  
  130.      /bin/*.exe
  131.      /bin/*.com
  132.      *.doc
  133.  
  134. Now we can use the command
  135.  
  136.      stuff / -name @select
  137.  
  138. to print the names of all files that match the patterns /bin/*.exe,
  139. /bin/*.com, and *.doc.  The above is exactly equivalent to typing:
  140.  
  141.      stuff / -name /bin/*.exe -name /bin/*.com -name *.doc
  142.  
  143. Due to MS-DOS's command line limit, the use of a file containing patterns
  144. allows you to specify more patterns than can be specified on the command
  145. line.
  146.  
  147. Patterns and @files may be intermixed on the command line in any order, and
  148. more than one @file can be specified.
  149.  
  150. The ! operator can be used with the @file syntax.  Exclusion of a filename
  151. like this overrrides all other conditions.  Thus if a filename is excluded
  152. with "! -name pattern" or "! -name @file", then that filename will never be
  153. printed, no matter how many other conditions select it.
  154.  
  155. If multiple filename patterns are excluded, then all files whose names match
  156. any of the exclusion patterns will be excluded.  
  157.  
  158. Suppose we have a file called STOPLIST that contains the following
  159. patterns:
  160.  
  161.      *.bak
  162.      *.bat
  163.      *.log
  164.      *.00?
  165.  
  166. Now if we give the command
  167.  
  168.      stuff / -name *.* ! -name @stoplist
  169.  
  170. Stuff 2.0 will select all files that match *.* (i.e. all files that contain a
  171. dot in the filename) EXCEPT those files that match any of the patterns in the
  172. STOPLIST file.
  173.  
  174. A STOPLIST file is useful if there are some types of files (e.g. backups, log
  175. files, etc.) that you do not normally want to select for archiving. Just put
  176. all the names or patterns in the STOPLIST, and tell Stuff 2.0 to exclude
  177. those.
  178.  
  179.  
  180. NOTE:  Stuff 2.0 does a sequential search through all the filename patterns
  181. supplied, whether on the command line or in a file.  Its speed will
  182. significantly slow down if this list is very long.  Keep the list of filename
  183. patterns to be searched to about 30 or fewer.
  184.  
  185.  
  186. SELECTING BY SIZE
  187.  
  188. The condition -size allows selection of files based on if they are equal to,
  189. larger than, or smaller than, a certain number of kilobytes in size.  A
  190. kilobyte is 1024 bytes.  A file is considered to be n kilobytes long if
  191. dividing its size in bytes by 1024 and ignoring the remainder gives a value
  192. of n.  For example, a file that is 10137 bytes long (9.89 kilobytes) is
  193. considered to be 9 kilobytes in size.  To select files that are 8 kilobytes
  194. long, use the condition:
  195.  
  196.      -size 8
  197.  
  198. To select files that are more than 8 kilobytes long, use the condition:
  199.  
  200.      -size +8
  201.  
  202. Similarly, to select files that are less than 8 kilobytes long use the
  203. condition:
  204.  
  205.      -size -8
  206.  
  207. One can use multiple conditions, and all must be met.  Thus
  208.  
  209.      -size +2 -size -9
  210.  
  211. will select all files that are 3 to 8 kilobytes long.
  212.  
  213. As with other conditions, ! reverses the sense of -size, so saying
  214.  
  215.      ! -size +8
  216.  
  217. selects files that are not bigger than 8 kilobytes.
  218.  
  219.  
  220. SELECTING BY AGE
  221.  
  222. The -older, -newer, and -mtime conditions allow file selection based on when
  223. a file was last modified.  To select a file that was modified in the last 24
  224. hours, the condition is:
  225.  
  226.      -mtime -1
  227.  
  228. which selects files that are less than 1 day old.   As before using !  will
  229. reverse this, so
  230.  
  231.      ! -mtime -1
  232.  
  233. selects only files that were not modified in the last 24 hours.  The
  234. conditions -older and -newer allow you to test to see if a file is older or
  235. newer than another file whose name you specify.  For example, the Stuff
  236. command
  237.  
  238.      stuff / -newer info.txt
  239.  
  240. searches the entire disk for all files that are newer than the file
  241. "info.txt".  The -older condition is complementary, and again, both may be
  242. combined with ! to reverse their sense, so that
  243.  
  244.      ! -older info.txt
  245.  
  246. selects files that are not older than "info.txt" (so they must be of the
  247. same age or newer).  The use of the -newer condition allows you to
  248. intelligently update files in a zoo archive with a command line of this
  249. type:
  250.  
  251.      stuff /sources ! -name *.obj -newer sources.zoo | zoo aI sources.zoo
  252.  
  253. This command tells Stuff to find all files in /sources and subdirectories
  254. that are newer than the zoo archive "sources.zoo" (and which are not *.obj
  255. files) and list their names.  Since the datestamp of a zoo archive reflects
  256. the age of the newest file stored in it, the effect of the above is to bring
  257. the zoo archive up-to-date.  Note that a similar (though not necessarily
  258. identical) effect could be obtained with:
  259.  
  260.      stuff /sources ! -name *.obj | zoo aIun sources.zoo
  261.  
  262. which tells stuff to list all non-*.obj files, and tells zoo to add only new
  263. or newer files to "sources.zoo".
  264.  
  265.  
  266. SELECTING MODIFIED FILES ONLY
  267.  
  268. MSDOS keeps track of whether or not a file has been backed up.  Some backup
  269. programs will set a file's backup status to be "backed up".  Every time a
  270. file is written to, MSDOS restores its backup status to mean "not backed
  271. up".  Thus it is easy to make sure that only those files that have been
  272. changed since the last backup was done will be backed up this time.  (This
  273. is the idea of an "incremental backup", which involves backing up only
  274. changed files.)
  275.  
  276. The -modified condition selects a file only if it has been modified since it
  277. was last backed up.  Reversing it with ! selects a file only if it has not
  278. been modified since it was last backed up.
  279.  
  280. Thus to archive all files that have been modified since their last backup, a
  281. possible command line is:
  282.  
  283.      stuff / -modified | zoo aI backups
  284.  
  285. which saves such files into "backups.zoo".  Note, however, that at this
  286. time, neither Stuff nor Zoo resets the file's backup status.
  287.  
  288.  
  289.                  MS-DOS BUGS
  290.  
  291. MS-DOS exhibits much confusion about the use of "/" and "\" to refer to
  292. directories.  Stuff consistently uses the forward slash in all pathnames it
  293. prints, though it will cheerfully accept pathnames typed by the user that
  294. contain backslashes too.  However, in a pattern following a -name condition
  295. or inside an @ file, a forward slash is needed.
  296.  
  297. Early versions of MS-DOS have a bug that prevents the root directory from
  298. being referred to as ".".  Instead of saying "stuff ." from the root
  299. directory, simply say "stuff /".
  300.  
  301.  
  302. GROUPING FILES BY BYTE LIMIT
  303.  
  304. Stuff 2.0 can be told to print files as groups such that the total size of
  305. files in each group does not exceed a user-specified limit of bytes.  The
  306. syntax to do this is:
  307.  
  308.      -limit N
  309.  
  310. where N is a decimal number giving the limit in bytes.  Stuff 2.0 does not
  311. use any special technique to combine files into groups.  It simply remembers
  312. the accumulated byte count and prints a line of dashes (---) as soon as the
  313. total byte count of files seen is about to exceed the limit.  Then it resets
  314. the total and starts counting again.  
  315.  
  316. This feature is experimental at this time, and probably not very useful.
  317.  
  318.  
  319.                CHANGES FROM VERSION 1.0
  320.  
  321. The changes from version 1.0 are the following:
  322.  
  323. 1.   The "-name @file" syntax is supported, allowing a list of patterns to be
  324. placed in a file.  The "-name @file" and "-name pattern" conditions may be
  325. freely intermixed in any order.
  326.  
  327. 2.   If multiple filename patterns are given using "-name pattern" or "-name
  328. @file", a file is selected by Stuff 2.0 if it matches at least one of the
  329. patterns.  Stuff 1.0 selected a file only if it matched all patterns given.
  330.  
  331.                                       -- Rahul Dhesi 1989/03/19
  332.